<?php
function getRequest($url)
{
	$socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
	socket_connect($socket, '127.0.0.1', 8192);
	$uri = 'http://127.0.0.1:8192';
	$query = '';
	$body = '';

	socket_write($socket, sprintf("GET %s?%s HTTP/1.0\r\n", $uri, $qs));
        socket_write($socket, "User-Agent: Socket_Backstage\r\n");
    //    socket_write($socket, "Content-type: application/x-www-form-urlencoded\r\n");
    	socket_write($socket, "content-type: text/html;charset=utf-8\r\n");
        socket_write($socket, sprintf("Content-length: %d\r\n", strlen($qs)));
        socket_write($socket, "Accept: */*\r\n");
        socket_write($socket, "\r\n");
        socket_write($socket, "\r\n");

	while($buf = socket_read($socket, 2048)){
		echo $buf.PHP_EOL;
	}
}
getRequest('');
